//package org.activoricordi.app.snippet
package edu.ucdavis.fiehnlab.alchemy.alchemyAdmin.snippet

/**
 * Created with IntelliJ IDEA.
 * User: naru
 * Date: 3/30/13
 * Time: 12:22 PM
 * To change this template use File | Settings | File Templates.
 */
import net.liftweb._
import http._
import net.liftweb.common.{Box,Full,Empty,Failure,ParamFailure}
import  edu.ucdavis.fiehnlab.alchemy.alchemyAdmin.model._
import SHtml._
import S._
import mapper._
import util._
import Helpers._

import scala.xml.{NodeSeq, Text}

class EditCompound {


  /**
   * get the current Compound id
   */

  var id = S.param("id") openOr ""

  var compound = try {
    /**
     * Search for the Compound
     */
    Compound.findByKey(id.toLong)
  } catch {
    case e:NumberFormatException => Empty
  }

  def edit(html: NodeSeq): NodeSeq ={
    compound map ({ i =>

    /**
     * create edit forum
     */
      i.toForm(Full("save"), "/compound/list")

      /**
       * if Compound is not Found
       */
    })openOr Text("Invalid Compound")
  }


}
